package com.shop.loan.proxy;

import cn.hutool.core.date.DateUtil;
import com.shop.loan.model.enums.OrderPoolType;
import com.shop.loan.model.view.LoanOrderPoolByToday;
import com.shop.loan.util.LoanOrderUtil;
import org.springframework.stereotype.Service;
import xyz.erupt.annotation.fun.DataProxy;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.Map;

@Service
public class LoanOrderPoolByTodayProxy implements DataProxy<LoanOrderPoolByToday> {

    @Resource
    LoanOrderUtil loanOrderUtil;

    @Override
    public void afterFetch(Collection<Map<String, Object>> list) {
        list.clear();
        String startTime = DateUtil.beginOfDay(new Date()).toString();
        String endTime = DateUtil.endOfDay(new Date()).toString();
        loanOrderUtil.searchDayOrderList(list, OrderPoolType.today_tom_pool.getType(), null, startTime, endTime);
        //列表显示字段完善
        loanOrderUtil.updateShowDayList(list);
    }
}
